package com.ruoyi.datam.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.core.domain.base.datam.WcSluiceB;
import com.ruoyi.datam.service.IWcSluiceBService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 水闸基本信息登记Controller
 * 
 * @author hwd
 * @date 2023-02-21
 */
@RestController
@RequestMapping("/WcSluiceB")
public class WcSluiceBController extends BaseController
{
    @Autowired
    private IWcSluiceBService wcSluiceBService;

    /**
     * 查询水闸基本信息登记列表
     */
    @RequiresPermissions("datam:WcSluiceB:list")
    @GetMapping("/list")
    public TableDataInfo list(WcSluiceB wcSluiceB)
    {
        startPage();
        List<WcSluiceB> list = wcSluiceBService.selectWcSluiceBList(wcSluiceB);
        return getDataTable(list);
    }

    /**
     * 查询水闸基本信息登记列表
     */
    @RequiresPermissions("datam:WcSluiceB:list")
    @GetMapping("/allList")
    public TableDataInfo AllList(WcSluiceB wcSluiceB)
    {
        List<WcSluiceB> list = wcSluiceBService.selectWcSluiceBList(wcSluiceB);
        return getDataTable(list);
    }

    /**
     * 导出水闸基本信息登记列表
     */
    @RequiresPermissions("datam:WcSluiceB:export")
    @Log(title = "水闸基本信息登记", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WcSluiceB wcSluiceB)
    {
        List<WcSluiceB> list = wcSluiceBService.selectWcSluiceBList(wcSluiceB);
        ExcelUtil<WcSluiceB> util = new ExcelUtil<WcSluiceB>(WcSluiceB.class);
        util.exportExcel(response, list, "水闸基本信息登记数据");
    }

    /**
     * 获取水闸基本信息登记详细信息
     */
    @RequiresPermissions("datam:WcSluiceB:query")
    @GetMapping(value = "/{sluCd}")
    public AjaxResult getInfo(@PathVariable("sluCd") String sluCd)
    {
        return success(wcSluiceBService.selectWcSluiceBBySluCd(sluCd));
    }

    /**
     * 新增水闸基本信息登记
     */
    @RequiresPermissions("datam:WcSluiceB:add")
    @Log(title = "水闸基本信息登记", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WcSluiceB wcSluiceB)
    {
        return toAjax(wcSluiceBService.insertWcSluiceB(wcSluiceB));
    }

    /**
     * 修改水闸基本信息登记
     */
    @RequiresPermissions("datam:WcSluiceB:edit")
    @Log(title = "水闸基本信息登记", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WcSluiceB wcSluiceB)
    {
        return toAjax(wcSluiceBService.updateWcSluiceB(wcSluiceB));
    }

    /**
     * 删除水闸基本信息登记
     */
    @RequiresPermissions("datam:WcSluiceB:remove")
    @Log(title = "水闸基本信息登记", businessType = BusinessType.DELETE)
	@DeleteMapping("/{sluCds}")
    public AjaxResult remove(@PathVariable String[] sluCds)
    {
        return toAjax(wcSluiceBService.deleteWcSluiceBBySluCds(sluCds));
    }
}
